<script setup>
import useStore from '@/store';
import { useRouter } from 'vue-router'
import { ref } from 'vue';
const loading = ref(false)
const store = useStore();
const router = useRouter();
const login = async () => {
  loading.value = true
  try {
    await store.user.login()
    router.replace('/')
  } catch (error) {
    loading.value = false
  }
}
</script>
<template>
  <div>
    <el-button :loading="loading" type="primary" size="default" @click="login()">登录</el-button>
  </div>
</template>
<style lang="scss" scoped></style>